#include "LeiJiaStartButton.h"
#include <QMouseEvent>
#include "LeiJiaWebHttp.h"
LeiJiaStartButton::LeiJiaStartButton(QWidget *parent)
	: QPushButton(parent)
{
	m_flag = false;
}

LeiJiaStartButton::~LeiJiaStartButton()
{

}


void LeiJiaStartButton::mousePressEvent(QMouseEvent* e)
{
	if (!m_flag)
	{
		QString style = QString(" QPushButton{border-image:url(%1);} ").arg(LeiJiaWebHttp::GetInstance()->startStateImage);
       setStyleSheet(style);

		m_flag = true;
		
	}
	else
	{
		QString style = QString(" QPushButton{border-image:url(%1);} ").arg(LeiJiaWebHttp::GetInstance()->endStateImage);
		setStyleSheet(style);
		m_flag = false;
	}
}

void  LeiJiaStartButton::mouseReleaseEvent(QMouseEvent* e)
{
	emit QPushButton::clicked();
}